﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Dycox.Reporting.Printing;

namespace Dycox.Windows.Forms
{
    public class ReportPrintPreviewDialog : PrintPreviewDialog
    {
        public ReportPrintPreviewDialog()
        {
            
        }

        IPaperNotFoundHandler _previousHandler;

        [DefaultValue(null)]
        public new ReportPrintDocument Document
        {
            get { return (ReportPrintDocument)base.Document; }
            set
            {
                ReportPrintDocument doc0 = (ReportPrintDocument)base.Document;

                if (doc0 != value)
                {
                    if (doc0 != null)
                        doc0.PaperNotFoundHandler = _previousHandler;

                    base.Document = value;

                    if (value != null)
                    {
                        _previousHandler = value.PaperNotFoundHandler;
                        value.PaperNotFoundHandler = new PaperNotFoundHandler(this);
                    }
                }
            }
        }
    }
}
